var a,
  t,
  i,
  e,
  n = require("../../@babel/runtime/helpers/defineProperty"),
  s = require("../../res/www.a9a.cn.js"),
  r = getApp(),
  d = 2,
  o = !0;
Page({
  data:
    ((a = { setInter: "", SO_title: "嘉宾筛选", t: 1, LIST_nodata: !1 }),
    n(a, "LIST_nodata", !1),
    n(a, "triggered", !0),
    n(a, "loading_flag", !1),
    n(a, "loading_ico_flag", !1),
    n(a, "loading_str", "拼命加载中"),
    a),
  onLoad: function (a) {
    var i = this,
      e = this;
    (t = a.id),
      r.get_config("_ZEAI").then(function (a) {
        e.setData({ color: r._ZEAI.color, rgbcolor: s.c16_rgb(r._ZEAI.color) });
      }),
      r.get_navigationBarTopHeight(this),
      r.get_openid().then(function (a) {
        i.init();
      });
  },
  init: function () {
    s.ifint(t) ||
      wx.showModal({
        content: rs.msg,
        confirmColor: a.data.color,
        confirmText: "朕知道了",
        showCancel: !1,
        success: function (a) {
          wx.navigateBack();
        },
      });
    var a = this;
    (d = 2), (e = []), wx.showLoading({ title: "拼命加载中...", mask: !0 });
    var n = {
      submitok: "huxuan_detail_ulist_init",
      openid: (i = wx.getStorageSync("COOK_U")).openid,
      id: t,
    };
    r.ajax({
      url: "huxuan.php",
      data: n,
      success: function (i) {
        1 == i.flag
          ? (a.setData({
              id: t,
              SO: i.SO,
              DJS: i.DJS,
              areaidARR: i.areaidARR,
              area2idARR: i.area2idARR,
            }),
            1 == i.DJS.flag && a.DJSFn(i.DJS.difftime),
            a.list(a.data.t))
          : "nobm" == i.flag
          ? wx.showModal({
              content: i.msg,
              confirmColor: a.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (a) {
                wx.redirectTo({ url: "../huxuan/huxuan_detail?id=" + t });
              },
            })
          : wx.showToast({ title: i.msg, icon: "none", mask: !0 }),
          wx.hideLoading();
      },
    });
  },
  uidFn: function (a) {
    var i = a.currentTarget.dataset.uid;
    wx.navigateTo({ url: "../hn/hn_u?ifhx=1&id=" + t + "&uid=" + i });
  },
  list: function () {
    var a = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 }), (o = !1);
    var d = {
      submitok: "huxuan_detail_ulist",
      openid: (i = wx.getStorageSync("COOK_U")).openid,
      id: t,
      t: a.data.t,
    };
    s.empty(e) ||
      (d = JSON.parse(
        (JSON.stringify(d) + JSON.stringify(e)).replace(/}{/, ",")
      )),
      r.ajax({
        url: "huxuan.php",
        data: d,
        success: function (t) {
          if (1 == t.flag)
            if (0 == t.LIST.length || s.empty(t.LIST)) {
              var i = !(t.VU.num > 0 && 2 == a.data.t);
              a.setData({ VU: t.VU, LIST: t.LIST, LIST_nodata: i });
            } else {
              var e;
              a.setData(
                ((e = { VU: t.VU }),
                n(e, "LIST[0]", t.LIST),
                n(e, "LIST_nodata", !1),
                e)
              );
            }
          else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          wx.hideLoading(), (o = !0);
        },
      });
  },
  topFn: function (a) {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        t.setData({
          triggered: !1,
          loading_flag: !1,
          loading_str: "拼命加载中",
          LIST: [],
          LIST_nodata: !1,
        }),
          (d = 2),
          (e = []),
          t.init();
      }, 500);
  },
  setloading: function (a, t) {
    "start" == a
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: t })
      : "end" == a
      ? this.setData({ loading_ico_flag: !1, loading_str: t })
      : "reset" == a &&
        this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: t,
        });
  },
  btmFn: function (a) {
    if (!s.empty(this.data.VU) && 2 == this.data.t) return !1;
    var c = this.data.LIST,
      l = this;
    if (o) {
      (o = !1), l.setloading("start", "拼命加载中");
      var f = {
        submitok: "huxuan_detail_ulist",
        p: d,
        openid: i.openid,
        id: t,
        t: l.data.t,
      };
      s.empty(e) ||
        (f = JSON.parse(
          (JSON.stringify(f) + JSON.stringify(e)).replace(/}{/, ",")
        )),
        r.ajax({
          url: "huxuan.php",
          data: f,
          success: function (a) {
            if (1 == a.flag) {
              var t = c.length;
              if (a.LIST.length < 1)
                return l.setloading("end", "已全部加载完毕"), void (o = !1);
              l.setData(n({}, "LIST[" + t + "]", a.LIST)), (d += 1), (o = !0);
            } else wx.showToast({ title: a.msg, icon: "none", mask: !0 });
            l.setloading("end", "上拉加载更多");
          },
        });
    }
  },
  scrollFn: function (a) {
    a.detail.scrollTop > 100
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function (a) {
    var t = "scrolltopNum_" + a.currentTarget.dataset.id;
    this.setData(n({}, t, 0));
  },
  DJSFn: function (a) {
    var t = this;
    t.data.setInter = setInterval(function () {
      var i = 0,
        e = 0,
        n = 0;
      a > 0
        ? ((i = Math.floor(a / 3600)),
          (e = Math.floor(a / 60) - 60 * i),
          (n = Math.floor(a) - 60 * i * 60 - 60 * e),
          i <= 9 && (i = "0" + i),
          e <= 9 && (e = "0" + e),
          n <= 9 && (n = "0" + n),
          t.setData({ djs_H: i, djs_M: e, djs_S: n }),
          a--)
        : (clearInterval(t.data.setInter), t.init());
    }, 1e3);
  },
  ulist_navFn: function (a) {
    var t = a.currentTarget.dataset.t;
    (e = []),
      (d = 2),
      this.setData({ t: t, LIST: [], loading_flag: !1 }),
      this.list();
  },
  blankFn: function () {},
  SOFn: function () {
    this.setData({ div_right_mask_class: "alpha0_100", div_right_flag: !0 });
  },
  SO_close_Fn: function () {
    var a = this;
    this.setData({ div_right_mask_class: "alpha100_0" }),
      setTimeout(function () {
        a.setData({ div_right_flag: !1 });
      }, 400);
  },
  SO_form_uid_submitFn: function (a) {
    var t = a.detail.value.keyword;
    (e = { keyword: t }),
      this.SO_close_Fn(),
      this.setData({ LIST: [] }),
      this.list();
  },
  SO_input_uid_submitFn: function (a) {
    var t = a.detail.value;
    (e = { keyword: t }),
      this.SO_close_Fn(),
      this.setData({ LIST: [] }),
      this.list();
  },
  SO_uid_bindblurFn: function (a) {
    var t = a.detail.value;
    this.setData({ keyword: t });
  },
  SO_liFn: function (a) {
    if ("vip" != a.currentTarget.dataset.auth) {
      var t,
        i = a.currentTarget.dataset.idx,
        e = a.currentTarget.dataset.i,
        r = a.currentTarget.dataset.fkind,
        d = this.data.SO[i].i;
      (t = s.empty(d)
        ? e
        : "checkbox" == r
        ? s.indexOf(d, e)
          ? (t = s.json_remove(d, e)).join(",")
          : d + "," + e
        : e),
        0 == e && (t = 0),
        this.setData(n({}, "SO[" + i + "].i", t));
    } else this.vipFn();
  },
  SO_submitFn: function (a) {
    ((e = a.detail.value).keyword = this.data.keyword),
      this.setloading("reset", "拼命加载中"),
      this.SO_close_Fn(),
      this.setData({ LIST: [] }),
      this.list();
  },
  SO_resetFn: function (a) {
    var t = this.data.SO;
    for (var i in t) {
      var e;
      this.setData(
        (n((e = {}), "SO[" + i + "].i", 0), n(e, "SO[" + i + "].v", ""), e)
      );
    }
    this.setData({ keyword: "" });
  },
  SO_onoffFn: function (a) {
    var t,
      i = a.currentTarget.dataset.index;
    (t = "on" == this.data.SO[i].onoff ? "off" : "on"),
      this.setData(n({}, "SO[" + i + "].onoff", t));
  },
  SO_rangFn: function (a) {
    a.currentTarget.dataset.f;
    var t,
      i = a.currentTarget.dataset.index,
      e = a.detail.value;
    if (e[0] > e[1])
      wx.showToast({ title: "请选择左小右大范围", icon: "none", mask: !0 });
    else {
      var r = s.idx_iv(e, this.data.SO[i].arr.arr[0]);
      this.setData(
        (n((t = {}), "SO[" + i + "].i", r[0]),
        n(t, "SO[" + i + "].v", r[1]),
        n(t, "SO[" + i + "].arr.def", e),
        t)
      );
    }
  },
  vipFn: function () {
    r.chklogin().then(function (a) {
      a
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  areaidFn: function (a) {
    for (
      var t,
        i = a.currentTarget.dataset.kind,
        e = (a.currentTarget.dataset.f, a.detail.value),
        r = a.currentTarget.dataset.idx,
        d = [],
        o = 0;
      o < e.length;
      o++
    )
      e[o] > 0 && d.push(e[o] - 1);
    if (((e = d), "hj" == i)) var c = s.areaGetTtitle(e, this.data.area2idARR);
    else c = s.areaGetTtitle(e, this.data.areaidARR);
    var l = c[0],
      f = c[1];
    this.setData(
      (n((t = {}), "SO[" + r + "].i", l), n(t, "SO[" + r + "].v", f), t)
    );
  },
  areaidChangeFn: function (a) {
    var t,
      i = a.currentTarget.dataset.kind,
      e = a.detail.column,
      r = a.detail.value,
      d = a.currentTarget.dataset.idx,
      o = "hj" == i ? 4 : parseInt(this.data.SO[d].arealeval),
      c = { def: this.data.SO[d].arr.def, idx: this.data.SO[d].arr.idx };
    if ("hj" == i)
      var l = this.data.area2idARR.ARR1,
        f = this.data.area2idARR.ARR2,
        h = this.data.area2idARR.ARR3,
        u = this.data.area2idARR.ARR4;
    else
      (l = this.data.areaidARR.ARR1),
        (f = this.data.areaidARR.ARR2),
        (h = this.data.areaidARR.ARR3),
        (u = this.data.areaidARR.ARR4);
    var g,
      _,
      S,
      x = [{ i: "0", v: "不限", f: "0" }],
      v = l,
      T = [],
      p = [],
      O = [];
    switch (((v = x.concat(v)), e)) {
      case 0:
        if (0 == r)
          switch (
            ((c.def[0] = v),
            o >= 2 && (c.def[1] = x),
            o >= 3 && (c.def[2] = x),
            o >= 4 && (c.def[3] = x),
            o)
          ) {
            case 1:
              c.idx = [0];
              break;
            case 2:
              c.idx = [0, 0];
              break;
            case 3:
              c.idx = [0, 0, 0];
              break;
            case 4:
              c.idx = [0, 0, 0, 0];
          }
        else
          switch (((g = l[r - 1].i), o)) {
            case 1:
              (c.def = [v]), (c.idx = [r]);
              break;
            case 2:
              (T = x.concat(s.areaNEW(g, f))),
                (c.def = [v, T]),
                (c.idx = [r, 0]);
              break;
            case 3:
              (T = x.concat(s.areaNEW(g, f))),
                (c.def = [v, T, x]),
                (c.idx = [r, 0, 0]);
              break;
            case 4:
              (T = x.concat(s.areaNEW(g, f))),
                (c.def = [v, T, x, x]),
                (c.idx = [r, 0, 0, 0]);
          }
        break;
      case 1:
        if (0 == r)
          o >= 3 && (c.def[2] = x),
            o >= 4 && (c.def[3] = x),
            o >= 2 && (c.idx[1] = r),
            o >= 3 && (c.idx[2] = 0),
            o >= 4 && (c.idx[3] = 0);
        else
          switch (o) {
            case 2:
              c.idx[1] = r;
              break;
            case 3:
              (g = l[c.idx[0] - 1].i),
                (_ = (T = x.concat(s.areaNEW(g, f)))[r].i),
                (p = x.concat(s.areaNEW(_, h))),
                (c.def[2] = p),
                (c.idx[1] = r),
                (c.idx[2] = 0);
              break;
            case 4:
              (g = l[c.idx[0] - 1].i),
                (_ = (T = x.concat(s.areaNEW(g, f)))[r].i),
                (p = x.concat(s.areaNEW(_, h))),
                (c.def[2] = p),
                (c.def[3] = x),
                (c.idx[1] = r),
                (c.idx[2] = 0),
                (c.idx[3] = 0);
          }
        break;
      case 2:
        if (0 == r)
          o >= 4 && (c.def[3] = x),
            o >= 3 && (c.idx[2] = r),
            o >= 4 && (c.idx[3] = 0);
        else
          switch (o) {
            case 3:
              c.idx[2] = r;
              break;
            case 4:
              (g = l[c.idx[0] - 1].i),
                (_ = (T = x.concat(s.areaNEW(g, f)))[c.idx[1]].i),
                (S = (p = x.concat(s.areaNEW(_, h)))[r].i),
                (O = x.concat(s.areaNEW(S, u))),
                (c.def[3] = O),
                (c.idx[2] = r),
                (c.idx[3] = 0);
          }
        break;
      case 3:
        o >= 4 && (c.idx[3] = r);
    }
    this.setData(
      (n((t = {}), "SO[" + d + "].arr.def", c.def),
      n(t, "SO[" + d + "].arr.idx", c.idx),
      t)
    );
  },
  nodatabackFn: function (a) {
    (e = ""),
      this.setData({
        loading_flag: !1,
        loading_str: "拼命加载中",
        LIST: [],
        huxuan_nodata: !1,
      }),
      (d = 2),
      this.init();
  },
});
